package com.lantosec.hmrp.modules.system.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.lantosec.hmrp.core.kit.ExcelField;
import com.lantosec.hmrp.core.mvc.BaseVO;
import com.lantosec.hmrp.modules.system.entity.SysUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author AutoCode
 * @since 2020-02-07
 */
@Data
@ApiModel(value = "SysUser对象", description = "用户表")
public class SysUserVO extends BaseVO<SysUser> {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "用户ID")
    @ExcelField(title = "用户ID")
    private String userId;
    @ApiModelProperty(value = "用户名")
    @ExcelField(title = "用户名")
    private String username;
    @JsonIgnore
    @ApiModelProperty(value = "密码")
    @ExcelField(title = "密码")
    private String password;
    @ApiModelProperty(value = "姓名")
    @ExcelField(title = "姓名")
    private String name;
    @ApiModelProperty(value = "手机号")
    @ExcelField(title = "手机号")
    private String phone;
    @ApiModelProperty(value = "图像")
    @ExcelField(title = "图像")
    private String picture;
    @ApiModelProperty(value = "状态")
    @ExcelField(title = "状态")
    private Integer state;
    @ApiModelProperty(value = "删除状态")
    private Integer flag;
    private String deptName;
    private String roleName;
    private String positionName;
    private String deptId;
    private String positionId;
    private String savePath;
    private List param;
    @TableField(exist = false)
    private String mainDept;
    @ApiModelProperty(value = "旧密码")
    private String oldPassword;
    @ApiModelProperty(value = "新密码")
    private String newPassword;


    public SysUserVO() {
    }

    public SysUserVO(SysUser entity) {
        this.userId = entity.getUserId();
        this.username = entity.getUsername();
        this.password = entity.getPassword();
        this.name = entity.getName();
        this.phone = entity.getPhone();
        this.picture = entity.getPicture();
        this.state = entity.getState();
        this.flag = entity.getFlag();
        this.deptName = entity.getDeptName();
        this.positionName = entity.getPositionName();
        this.roleName = entity.getRoleName();
    }

    @JsonSetter
    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public SysUser convertToEntity() {
        return new SysUser(this);
    }


}
